var e = require, t = module, n = exports;

Object.defineProperty(n, "__esModule", {
    value: !0
}), n.G = n.OS = n.Platform = n.Type = n.ItemType = n.RewardType = n.RankListData = n.EggData = n.EggConfig = void 0;

var o = e("GunModel"), i = e("PersonModel"), a = e("MD5"), r = e("GameData"), s = e("GameConfig");

n.EggConfig = function(t) {
    this.count = 1, this.flag = 1, this.idx = t;
}, n.EggData = function(t) {
    this.count = 0, this.time = 0, this.flag = 0, this.idx = t;
}, n.RankListData = function() {}, function(t) {
    t[t.DIAMOND = 0] = "DIAMOND", t[t.MONEY = 1] = "MONEY", t[t.SKIN = 2] = "SKIN", 
    t[t.PET = 3] = "PET", t[t.ARM = 4] = "ARM", t[t.PIECE = 5] = "PIECE", t[t.DRAGON = 6] = "DRAGON", 
    t[t.ELF = 7] = "ELF", t[t.BOX = 8] = "BOX", t[t.STONE = 9] = "STONE", t[t.ANGLE = 10] = "ANGLE", 
    t[t.EQUIP = 11] = "EQUIP";
}(n.RewardType || (n.RewardType = {})), function(t) {
    t[t.MONEY = 0] = "MONEY", t[t.DIAMOND = 1] = "DIAMOND", t[t.MEDICAL = 2] = "MEDICAL", 
    t[t.BUFFER = 3] = "BUFFER", t[t.CHRISTMAS = 4] = "CHRISTMAS", t[t.NEWYEAR = 5] = "NEWYEAR";
}(n.ItemType || (n.ItemType = {})), n.Type = cc.Enum({
    Default: 0,
    Browser: 1,
    Mobile: 2,
    Native: 3
}), n.Platform = cc.Enum({
    Default: 0,
    QuTouTiao: 1,
    QuTouTiaoAndroid: 2,
    H4399: 3,
    H4399Android: 4,
    WECHAT: 5,
    QQ: 6,
    ByteDance: 7,
    OPPO: 8,
    Vivo: 9,
    BaoQu: 10,
    UCMiniGame: 11,
    OPPOAndroid: 12,
    XIAOMIAndroid: 13,
    ByteDanceAndroid: 14,
    KWAIGAME: 15,
    Android: 16,
    IOS: 17,
    Kuaidianwan: 18,
    XiaoDu: 19
}), n.OS = cc.Enum({
    Default: 0,
    IOS: 1,
    Android: 2
});

var c = function() {
    function t() {
        this.platform = n.Platform.Default, this.isIOS = cc.sys.os === cc.sys.OS_IOS, this.isAuth = !1, 
        this.age = 0, this.serverUrl = "https://game.17tcw.com/", this.launchOptions = null, 
        this.isInit = !1, this.isLoad = !1, this.isFrist = !0, this.isAnonymous = !1, this.isMpCheckChannel = !1, 
        this.sensitiveCity = !1, this.drawProgress = 0, this.isVideoPlaying = !1, this.isExist = !0, 
        this.isFollow = !0, this.queue = [], this.chargeList = [ 0, 0, 0, 0 ], this.winlast = 0, 
        this.playcount = 0, this.wincount = 0, this.losecount = 0, this.seasoncount = 0, 
        this.seasonNextTime = 0, this.seasonTime = 0, this.personModelList = [], this.eggPersonModelList = [], 
        this.machineModelList = [], this.gunModelList = [], this.eggGunModelList = [], this.machineGunModelList = [], 
        this.drawGunModelList = [], this.olympicGunModelList = [], this.tryPersonIdx = -1, 
        this.tryPersonMap = new Map(), this.tryGunIdx = -1, this.tryPetIdx = -1, this.tryMachineIdx = -1, 
        this.profit = 0, this.christmasPlayCount = 0, this.christmasItems = [], this.newYearPlayCount = 0, 
        this.newYearDropCount = 0, this.newYearDropTotal = 10, this.newYearItems = [], this.newActivityCodeCount = 0, 
        this.season = 0, this.seasonPersonIdx = 0, this.seasonGunIdx = 0, this.price = [ 100, 1500, 4800 ], 
        this.order = [], this.petSkill = [ [ 1, 1, 1 ], [ .5, 1, 1 ], [ .25, .5, 1 ] ], 
        this.petEvolve = [ 10, 30, 50 ], this.petMaxLevel = 50, this.levelList = [ "不屈黑铁", "倔强青铜", "英勇白银", "荣耀黄金", "闪耀铂金", "永恒钻石", "至尊星耀", "顶级大师", "最强王者", "月光霸主", "至尊王者", "天下无敌" ], 
        this.ONE_DAY_TIME = 864e5, this.audioPath = "audio", this.jsons = [], this.resMap = new Map(), 
        this.Config = new Map(), this.bannerConfigMap = new Map(), this.bannerDataMap = new Map(), 
        this.guideConfigMap = new Map(), this.guideDataMap = new Map(), this.videoReward = 0, 
        this.subscribeTmplIds = [], this.peakRankData = null, this.timestamp = 0, this.localTime = 0, 
        this.key = "mVZTtAyMB8lBBB0z";
    }
    return t.prototype.genSignData = function(t) {
        var e, i = [];
        for (e in t) null == t[e] && i.push(e);
        for (;0 < i.length; ) delete t[i.pop()];
        return t.timestamp = n.G.timestamp + Date.now() - n.G.localTime, t.nonce = n.G.getUuid(), 
        t.sign = null, t.sign = n.G.getSignTemp(t), t;
    }, t.prototype.getUuid = function() {
        for (var t = [], n = 0; n < 36; n++) t[n] = "0123456789abcdef".substr(Math.floor(16 * Math.random()), 1);
        return t[14] = "4", t[19] = "0123456789abcdef".substr(3 & t[19] | 8, 1), t[8] = t[13] = t[18] = t[23] = "-", 
        t.join("");
    }, t.prototype.getSignTemp = function(t) {
        var e, i = [];
        for (e in t) "sign" != e && i.push(e + "=" + t[e]);
        return a.MD5.hex_md5(i.sort().join("&") + "&key=" + n.G.key).toLocaleUpperCase();
    }, t.prototype.getCirclePoints = function(t, n, e, i, o) {
        void 0 === i && (i = .5), void 0 === o && (o = 360);
        for (var r = [], s = Math.PI / 180 * Math.round(o / e), a = 0; a < e; a++) {
            var u = n.x + t * Math.sin(s * a), c = n.y + t * Math.cos(s * a);
            r.unshift(cc.v2(u + Math.random() * i, c + Math.random() * i));
        }
        return r;
    }, t.prototype.init = function() {
        var t, n, e = this;
        this.isInit ? console.log("G already init") : (GA.isWeChat() || GA.isQQ() ? (GA.PA.getSetting({
            success: function(t) {
                t.authSetting["scope.userInfo"] && (e.isAuth = !0);
            }
        }), GA.PA.onAudioInterruptionBegin(function() {
            console.log("onAudioInterruptionBegin"), cc.audioEngine.pauseAll();
        }), GA.PA.onAudioInterruptionEnd(function() {
            console.log("onAudioInterruptionEnd"), cc.audioEngine.resumeAll();
        })) : GA.isByteDance() ? GA.PA.getSetting({
            success: function(t) {
                t.authSetting["scope.userInfo"] && (e.isAuth = !0);
            }
        }) : GA.isPlatform(GA.Platform.UCMiniGame) && GA.PA.getSetting({
            success: function(t) {
                t.userInfo && (e.isAuth = !0);
            }
        }), null === (n = null === (t = GA.PA) || void 0 === t ? void 0 : t.setKeepScreenOn) || void 0 === n || n.call(t, {
            keepScreenOn: !0
        }), this.isInit = !0, console.log("G is inited."));
    }, t.prototype.isNative = function() {
        return cc.sys.platform != cc.sys.OPPO_GAME && cc.sys.platform != cc.sys.VIVO_GAME && this.platform != n.Platform.KWAIGAME && cc.sys.isNative;
    }, t.prototype.isGuide = function(t) {
        return !(!t || !n.G.guideConfigMap.has(t) || !n.G.guideConfigMap.get(t).enable);
    }, t.prototype.isBanner = function(t) {
        if (t && n.G.bannerConfigMap.has(t)) {
            if (n.G.sensitiveCity && !s.GC.isDebug) return !1;
            var e = n.G.bannerConfigMap.get(t);
            if (!e.enable) return !1;
            if (!e.count || e.count < 0) return !0;
            var i = {
                tag: t,
                count: 0
            };
            return n.G.bannerDataMap.has(t) ? i = n.G.bannerDataMap.get(t) : n.G.bannerDataMap.set(t, i), 
            e.count > i.count && (i.count++, n.G.bannerDataMap.set(t, i), !0);
        }
        return !1;
    }, t.prototype.getPrice = function(t, n) {
        return isNaN(n) && (n = this.getCount(t)), t < 0 ? this.checkPrice(Math.round(this.price[0] * Math.pow(s.GC.baseNum, n))) : t < 3 ? this.checkPrice(Math.round(this.price[t] * Math.pow(s.GC.baseNum, n))) : this.checkPrice(Math.round(this.price[this.price.length - 1] * Math.pow(3.1, t - this.price.length + 1) * Math.pow(s.GC.baseNum, n)));
    }, t.prototype.checkPrice = function(t, n) {
        return void 0 === n && (n = 100), isNaN(t) ? n : t;
    }, t.prototype.getCount = function(t) {
        return t < r.GD.count.length && -1 < t ? this.checkPrice(r.GD.count[t], 0) : 0;
    }, t.prototype.getProfit = function(t) {
        return t < 0 ? 0 : this.checkPrice(Math.round(1.2 * Math.pow(2.11, t)), 1);
    }, t.prototype.getIdxByRank = function(t) {
        return 0 == this.order.length ? t : t < 0 ? this.order[0] : t < this.order.length ? this.order[t] : t;
    }, t.prototype.getRank = function(t) {
        t < 0 && (t = 0);
        var n = 0;
        if (1 < s.GC.rankConfig.length) {
            for (var e = 0; e < s.GC.rankConfig.length - 1; ) {
                var i = (s.GC.rankConfig[e + 1].r - s.GC.rankConfig[e].r) * s.GC.rankConfig[e].n;
                if (!(n + i <= t)) break;
                n += i, e++;
            }
            var o = Math.max(0, Math.min(s.GC.rankConfig[e].r + Math.floor((t - n) / s.GC.rankConfig[e].n), s.GC.maxRank)), r = t - n - (o - s.GC.rankConfig[e].r) * s.GC.rankConfig[e].n;
            return {
                r: o,
                n: s.GC.rankConfig[e].n,
                s: r
            };
        }
        return {
            r: Math.max(0, Math.min(Math.floor(t / 3), s.GC.maxRank)),
            n: 3,
            s: t - 3 * s.GC.maxRank
        };
    }, t.prototype.getLevel = function(t) {
        t.r < 0 && (t.r = 0), 11 < t.r && (t.r = 11);
        var n = 0;
        if (1 < s.GC.rankConfig.length) {
            for (var e = 0; e < s.GC.rankConfig.length - 1; ) {
                var i = (s.GC.rankConfig[e + 1].r - s.GC.rankConfig[e].r) * s.GC.rankConfig[e].n;
                if (!(t.r > s.GC.rankConfig[e + 1].r)) break;
                n += i, e++;
            }
            return (t.r - s.GC.rankConfig[e].r) * s.GC.rankConfig[e].n + n;
        }
        return t.r * t.n + t.s;
    }, t.prototype.getPersonModel = function(e) {
        void 0 === e && (e = r.GD.personIdx);
        try {
            var t = n.G.personModelList.filter(function(t) {
                return t.id == e;
            });
            return 0 < t.length ? t[0] : this.getEggPersonModel(e);
        } catch (t) {
            return cc.error(t), new i.default();
        }
    }, t.prototype.getGunModel = function(t) {
        void 0 === t && (t = r.GD.gunIdx);
        try {
            return 3e3 <= t ? this.getOlympicGunModel(t) : 2e3 <= t ? this.getDrawGunModel(t) : t < 0 || 1e3 <= t ? this.getEggGunModel(t) : t >= this.gunModelList.length ? 0 == this.gunModelList.length ? new o.default() : this.gunModelList[this.gunModelList.length - 1] : n.G.gunModelList[t];
        } catch (t) {
            return cc.error(t), new o.default();
        }
    }, t.prototype.getEggPersonModel = function(e) {
        var i = this, t = n.G.eggPersonModelList.filter(function(t) {
            return t.id == i.getEggIdx(e, 2);
        });
        return 0 < t.length ? t[0] : null;
    }, t.prototype.getEggGunModel = function(t) {
        return n.G.eggGunModelList[this.getEggIdx(t)];
    }, t.prototype.getEggIdx = function(t, e) {
        if (1 == (e = void 0 === e ? 1 : e)) {
            if (t < 0) {
                e = Math.abs(t) - 1;
                return -1 < e && e < n.G.eggGunModelList.length ? e : 0;
            }
            return 1e3 <= t ? t - 1e3 : t;
        }
        if (t < 0) {
            var i = Math.abs(t) - 1;
            return 0 < n.G.eggPersonModelList.filter(function(t) {
                return t.id == i;
            }).length ? i : 0;
        }
        if (100 <= t) return t - 100;
    }, t.prototype.getOlympicGunModel = function(t) {
        return n.G.olympicGunModelList[this.getOlympicIdx(t)];
    }, t.prototype.getOlympicIdx = function(t) {
        return 3e3 <= t ? t - 3e3 : t;
    }, t.prototype.getDrawGunModel = function(t) {
        return n.G.drawGunModelList[this.getDrawIdx(t)];
    }, t.prototype.getDrawIdx = function(t) {
        return 2e3 <= t ? t - 2e3 : t;
    }, t.prototype.getPetSkill = function(t, n) {
        return void 0 === n && (n = 0), t >= s.GC.petSkillList.length ? s.GC.petSkillList[n >= s.GC.petSkillList.length ? 0 : n] : s.GC.petSkillList[t];
    }, t.prototype.checkSeason = function(t) {
        void 0 === t && (t = new Date());
        var n = this.formatDate(s.GC.seasonDateConfig, t), e = s.GC.seasonContinueConfig * this.ONE_DAY_TIME, i = s.GC.seasonIntervalConfig * this.ONE_DAY_TIME, n = t.getTime() - n.getTime();
        return 0 < n ? Math.ceil(n / (e + i)) : -1;
    }, t.prototype.formatDate = function(t, n) {
        return void 0 === n && (n = new Date()), new Date(isNaN(t.y) ? n.getFullYear() : t.y, isNaN(t.m) ? n.getMonth() : t.m - 1, isNaN(t.d) ? n.getDate() : t.d);
    }, t.prototype.shakeEffect = function(t, n) {
        0 < t.getNumberOfRunningActions() || (cc.tween(t).repeatForever(cc.tween().by(.02, {
            position: cc.v2(2, -2)
        }).by(.02, {
            position: cc.v2(-2, 2)
        }).by(.02, {
            position: cc.v2(-3, 2)
        }).by(.02, {
            position: cc.v2(3, -3)
        }).by(.02, {
            position: cc.v2(-1, 1)
        }).by(.02, {
            position: cc.v2(2, -8)
        }).by(.02, {
            position: cc.v2(-8, -10)
        }).by(.02, {
            position: cc.v2(3, 10)
        }).by(.02, {
            position: cc.v2(0, 0)
        })).start(), setTimeout(function() {
            cc.Tween.stopAllByTarget(t), t.setPosition(cc.Vec2.ZERO);
        }, 1e3 * n));
    }, t.prototype.bezier = function(t, n, e, i, o) {
        var r = 1 - o;
        return r * (r * (t + (3 * n - t) * o) + 3 * e * o * o) + i * o * o * o;
    }, t.prototype.bezierTo = function(t, e, i, o, r, s) {
        var a = e.x, u = e.y, c = i.x, h = i.y;
        return (r = r || Object.create(null)).progress = function(t, e, i, o) {
            return i.x = n.G.bezier(t.x, a, c, e.x, o), i.y = n.G.bezier(t.y, u, h, e.y, o), 
            i;
        }, s.to(t, {
            position: o
        }, r);
    }, t.prototype.getRectByVec = function(t, n, e) {
        if (0 < e) {
            var i = t.add(n.rotate(cc.misc.degreesToRadians(e))), o = t.add(n.rotate(cc.misc.degreesToRadians(-e))), r = t.add(n), s = Math.min(t.x, i.x, o.x, r.x), a = Math.min(t.y, i.y, o.y, r.y);
            return s == (u = Math.max(t.x, i.x, o.x, r.x)) && (u += 1), a == (o = Math.max(t.y, i.y, o.y, r.y)) && (o += 1), 
            cc.rect(s, a, u - s, o - a);
        }
        var u, r = t.add(n), s = Math.min(t.x, r.x), a = Math.min(t.y, r.y);
        return s == (u = Math.max(t.x, r.x)) && (u += 1), a == (o = Math.max(t.y, r.y)) && (o += 1), 
        cc.rect(s, a, u - s, o - a);
    }, t;
}();

n.G = new c(), window.G = n.G;